# from demo_unittest.unittest_base.unit_calculator import TestCount
from demo_unittest.unittest_base import unit_calculator
import unittest
import HTMLTestRunner

if __name__ == '__main__':
    suite = unittest.TestSuite()
    # testcases = unittestdemo.TestLoader().loadTestsFromTestCase(TestCount)    #添加类

    # testcases = unittest.TestLoader().loadTestsFromModule(unit_calculator)  #添加模块
    # suite.addTest(test=testcases)

    # testcase = unittest.TestLoader().loadTestsFromName('unit_calculator')
    # suite.addTest(testcase)

    # 可以导入模块, 类, 方法
    testcases = unittest.TestLoader().loadTestsFromNames(['unit_calculator', 'unit_calculator.TestCount.test_sub'])
    suite.addTests(testcases)

    # 无测试报告
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(suite)

    # file = r'E:\Python\APITest\demo_unittest\unittest_base\run_result.html'
    # fp = open(file, 'wb')
    # runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title='接口测试测试报告', description='用例执行情况：')
    # runner.run(suite)
    # fp.close()
